﻿@using MyWebProject.Models.QueryResult;
@using MyWebProject.Models.Entity;
<a name="ConversationBoard"></a>
<div class="row">
    @{
        List<MsgBoardResult> list = Model as List<MsgBoardResult>;
        if (list.Count == 0)
        {
            <span style="color:#808080;text-align:center">没有更多留言啦</span>
        }
        foreach (MsgBoardResult comment in list)
        {
            <div class="row" id="@comment.POST_ID.ToString()@comment.COMMENTS_ID.ToString()" style="margin-top:2px">
                <div class="col-md-1" style="float:left">
                    <div class="row">
                        <img class="img-rounded" style="float:left" src="@comment.AVATAR_URL">
                    </div>
                    <div class="row" style="font-size:x-small;word-break:break-all;text-align:center;">@comment.NICK_NAME</div>
                </div>

                <div class="col-md-9" style="float:left">
                    <div class="alert alert-info" style="margin-bottom:0px;padding-bottom:20px">
                        <div class="row" style="padding-left: 15px; padding-right: 15px;">
                            <p style="word-break:break-all;font-size:small; word-wrap:break-word;float:left ">
                                @Html.Raw(System.Web.HttpUtility.UrlDecode(comment.TEXT))
                            </p>
                        </div>
                        <div class="row" style="float:right;margin-right:5px">
                            <span style="font-size:xx-small;font-style:italic">@comment.DATE</span>
                            <a href="javascript:void(0)">
                                <em style="font-size:x-small" onclick="reply(@comment.POST_ID, @comment.COMMENTS_ID,'Home/ConversationMsgBoard')">回复</em>
                            </a>
                        </div>
                    </div>
                </div>
            </div>if (comment.REPLY != null)
            {
                foreach (COMMENTS m in comment.REPLY)
                {

                    <div class="row" style="margin-top:2px">
                        <div class="col-md-1" style="float:right">
                            <div class="row">
                                <img class="img-rounded" style="float:left" src="@m.AVATAR_URL">
                            </div>
                            <div class="row" style="font-size:x-small;word-break:break-all;text-align:center;">@m.NICK_NAME</div>
                        </div>
                        <div class="col-md-9" style="float:right">
                            <div class="alert alert-success" style="margin-bottom:0px;padding-bottom:20px">
                                <div class="row" style="padding-left: 15px; padding-right: 15px;">
                                    <p style="font-size:small;word-wrap:break-word;;float:left ;word-break:break-all">
                                      @Html.Raw(System.Web.HttpUtility.UrlDecode(m.TEXT))
                                    </p>
                                </div>
                                <div class="row" style="float:right;margin-right:5px;">
                                    @{  double day = DateTime.Now.Subtract(m.DATE).TotalDays;
                                        if (day > 1.0)
                                        {
                                            <span style="font-size:xx-small;font-style:italic;">@day.ToString().Split('.')[0] 天前</span>
}
                                        else
                                        {
                                            double hours = Math.Round(DateTime.Now.Subtract(m.DATE).TotalHours, 0);
                                            if (hours > 1)
                                            {
                                                <span style="font-size:xx-small;font-style:italic;">@hours 小时前</span>
}
                                            else
                                            {
                                                double minutes = Math.Round(DateTime.Now.Subtract(m.DATE).TotalMinutes, 0);
                                                <span style="font-size:xx-small;font-style:italic;">@minutes 分钟前</span>
}
                                        }
                                    }
                                </div>
                            </div>
                        </div>
                    </div>           }
                                            }
                                        }
    }
</div>
<script>
    function emojiInit() {
        $("#comment").emojioneArea({
            autoHideFilters: true
        });
    }
</script>

